﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ValidationExample.Common">

    <ControlTemplate x:Key="ValidationTextbox" TargetType="TextBox">
        <Grid>
            <Grid.Resources>
                <Style x:Name="DeleteButtonStyle" TargetType="Button">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="Button">
                                <Grid>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup x:Name="CommonStates">
                                            <VisualState x:Name="Normal" />
                                            <VisualState x:Name="PointerOver">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
                                                                                               Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPointerOverBackgroundThemeBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
                                                                                               Storyboard.TargetProperty="BorderBrush">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPointerOverBorderThemeBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement"
                                                                                               Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPointerOverForegroundThemeBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Pressed">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
                                                                                               Storyboard.TargetProperty="Background">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPressedBackgroundThemeBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
                                                                                               Storyboard.TargetProperty="BorderBrush">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPressedBorderThemeBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement"
                                                                                               Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPressedForegroundThemeBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation Storyboard.TargetName="BackgroundElement"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="0"
                                                                                 Duration="0" />
                                                    <DoubleAnimation Storyboard.TargetName="BorderElement"
                                                                                 Storyboard.TargetProperty="Opacity"
                                                                                 To="0"
                                                                                 Duration="0" />
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Border x:Name="BorderElement"
                                                        BorderBrush="{StaticResource TextBoxButtonBorderThemeBrush}"
                                                        BorderThickness="{TemplateBinding BorderThickness}"/>
                                    <Border x:Name="BackgroundElement"
                                                        Background="{StaticResource TextBoxButtonBackgroundThemeBrush}"
                                                        Margin="{TemplateBinding BorderThickness}">
                                        <TextBlock x:Name="GlyphElement"
                                                               Foreground="{StaticResource TextBoxButtonForegroundThemeBrush}"
                                                               VerticalAlignment="Center"
                                                               HorizontalAlignment="Center"
                                                               Text="&#xE0A4;"
                                                               FontFamily="{StaticResource SymbolThemeFontFamily}"/>
                                    </Border>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Grid.Resources>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
                                                                       Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledBackgroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
                                                                       Storyboard.TargetProperty="BorderBrush">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledBorderThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement"
                                                                       Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledForegroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Normal">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="BackgroundElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To="{StaticResource TextControlBackgroundThemeOpacity}" />
                            <DoubleAnimation Storyboard.TargetName="BorderElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To="{StaticResource TextControlBorderThemeOpacity}" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="PointerOver">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="BackgroundElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To="{StaticResource TextControlPointerOverBackgroundThemeOpacity}" />
                            <DoubleAnimation Storyboard.TargetName="BorderElement"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To="{StaticResource TextControlPointerOverBorderThemeOpacity}" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Focused" >
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="ValidationBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To="0" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="ButtonStates">
                    <VisualState x:Name="ButtonVisible">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton"
                                                                       Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="ButtonCollapsed" />
                </VisualStateGroup>
                <VisualStateGroup x:Name="ValidationStates">
                    <VisualState x:Name="Valid"/>
                    <VisualState x:Name="ValidWithWarning">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetName="ValidationBorder" Storyboard.TargetProperty="BorderThickness">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00.000">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>3</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Invalid">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetName="ValidationBorder" Storyboard.TargetProperty="BorderThickness">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00.000">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>3</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="InvalidRequired">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="AsteriskImage"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To="1" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="28"/>
            </Grid.ColumnDefinitions>
            <Border x:Name="BackgroundElement"
                                Background="{TemplateBinding Background}"
                                Margin="{TemplateBinding BorderThickness}"
                                Grid.ColumnSpan="2"/>

            <Border x:Name="BorderElement"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Grid.ColumnSpan="2"/>
            <Border x:Name="ValidationBorder"
                                BorderBrush="Red"
                                BorderThickness="0"
                                Grid.ColumnSpan="2"/>
            <ScrollViewer x:Name="ContentElement"
                                      HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
                                      HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                      VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
                                      VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                      IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
                                      IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
                                      IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
                                      Margin="{TemplateBinding BorderThickness}"
                                      Padding="{TemplateBinding Padding}"
                                      IsTabStop="False"
                                      ZoomMode="Disabled" />
            <Button x:Name="DeleteButton"
                                Style="{StaticResource DeleteButtonStyle}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                IsTabStop="False"
                                Grid.Column="1"
                                Visibility="Collapsed"
                                FontSize="{TemplateBinding FontSize}"
                                VerticalAlignment="Stretch" />
            <Image x:Name="AsteriskImage" Source="/Assets/Asterisk.png" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Stretch="None" Opacity="0"/>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="ValidationComboBox" TargetType="ComboBox">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="32" />
                <ColumnDefinition Width="28"/>
            </Grid.ColumnDefinitions>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="PointerOver">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background"
                                                                       Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxPointerOverBackgroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background"
                                                                       Storyboard.TargetProperty="BorderBrush">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxPointerOverBorderThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Highlight"
                                                                       Storyboard.TargetProperty="Fill">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxSelectedPointerOverBackgroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background"
                                                                       Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxPressedBackgroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background"
                                                                       Storyboard.TargetProperty="BorderBrush">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxPressedBorderThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
                                                                       Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxPressedForegroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimation Storyboard.TargetName="PressedBackground"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1"
                                                         Duration="0" />
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownGlyph"
                                                                       Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxArrowPressedForegroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background"
                                                                       Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxDisabledBackgroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background"
                                                                       Storyboard.TargetProperty="BorderBrush">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxDisabledBorderThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
                                                                       Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxDisabledForegroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownGlyph"
                                                                       Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxArrowDisabledForegroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="HighlightBackground"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1"
                                                         Duration="0" />
                            <DoubleAnimation Storyboard.TargetName="Highlight"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1"
                                                         Duration="0" />
                            <DoubleAnimation Storyboard.TargetName="ValidationBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To="0" />
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
                                                                       Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxFocusedForegroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="FocusedPressed">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="ValidationBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To="0" />
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
                                                                       Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxPressedForegroundThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Highlight"
                                                                       Storyboard.TargetProperty="Fill">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ComboBoxPressedHighlightThemeBrush}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Unfocused" />
                    <VisualState x:Name="PointerFocused" />
                    <VisualState x:Name="FocusedDropDown">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PopupBorder"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="DropDownStates">
                    <VisualState x:Name="Opened">
                        <Storyboard>
                            <SplitOpenThemeAnimation
                                          OpenedTargetName="PopupBorder"
                                          ContentTargetName="ScrollViewer"
                                          ClosedTargetName="ContentPresenter"
                                          ContentTranslationOffset="0"
                                          OffsetFromCenter="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownOffset}"
                                          OpenedLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownOpenedHeight}"
                                          ClosedLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownClosedHeight}" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Closed">
                        <Storyboard>
                            <SplitCloseThemeAnimation
                                          OpenedTargetName="PopupBorder"
                                          ContentTargetName="ScrollViewer"
                                          ClosedTargetName="ContentPresenter"
                                          ContentTranslationOffset="40"
                                          OffsetFromCenter="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownOffset}"
                                          ContentTranslationDirection="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.SelectedItemDirection}"
                                          OpenedLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownOpenedHeight}"
                                          ClosedLength="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.DropDownClosedHeight}" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="ValidationStates">
                    <VisualState x:Name="Valid"/>
                    <VisualState x:Name="ValidWithWarning">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetName="ValidationBorder" Storyboard.TargetProperty="BorderThickness">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00.000">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>3</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Invalid">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.001" Storyboard.TargetName="ValidationBorder" Storyboard.TargetProperty="BorderThickness">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00.000">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>3</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="InvalidRequired">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="AsteriskImage"
                                                         Storyboard.TargetProperty="Opacity"
                                                         Duration="0"
                                                         To="1" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Background"
                                Grid.ColumnSpan="2"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" />
            <Rectangle x:Name="PressedBackground"
                                   Fill="{StaticResource ComboBoxPressedHighlightThemeBrush}"
                                   Margin="{TemplateBinding BorderThickness}"
                                   Opacity="0" />
            <Border x:Name="HighlightBackground"
                                Grid.ColumnSpan="2"
                                Background="{StaticResource ComboBoxFocusedBackgroundThemeBrush}"
                                BorderBrush="{StaticResource ComboBoxFocusedBorderThemeBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Opacity="0" />
            <Rectangle x:Name="Highlight"
                                   Fill="{StaticResource ComboBoxSelectedBackgroundThemeBrush}"
                                   Margin="{TemplateBinding BorderThickness}"
                                   Opacity="0" />
            <Border x:Name="ValidationBorder" BorderBrush="Red" Grid.ColumnSpan="2"/>
            <ContentPresenter x:Name="ContentPresenter"
                                          Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
            <TextBlock x:Name="DropDownGlyph"
                                   Text="&#57361;"
                                   Grid.Column="1"
                                   IsHitTestVisible="False"
                                   Margin="0,0,6,4"
                                   Foreground="{StaticResource ComboBoxArrowForegroundThemeBrush}"
                                   FontWeight="Bold"
                                   FontSize="{StaticResource ComboBoxArrowThemeFontSize}"
                                   FontFamily="{StaticResource SymbolThemeFontFamily}"
                                   HorizontalAlignment="Right"
                                   VerticalAlignment="Center" />
            <Popup x:Name="Popup">
                <Border x:Name="PopupBorder"
                                    Background="{StaticResource ComboBoxPopupBackgroundThemeBrush}"
                                    BorderBrush="{StaticResource ComboBoxPopupBorderThemeBrush}"
                                    BorderThickness="{StaticResource ComboBoxPopupBorderThemeThickness}"
                                    HorizontalAlignment="Stretch">
                    <ScrollViewer x:Name="ScrollViewer" Foreground="{StaticResource ComboBoxPopupForegroundThemeBrush}"
                                              VerticalSnapPointsType="OptionalSingle"
                                              VerticalSnapPointsAlignment="Near"
                                              HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
                                              HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                              VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
                                              VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                              IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
                                              IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
                                              IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
                                              BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}"
                                              ZoomMode="Disabled">
                        <ItemsPresenter/>
                    </ScrollViewer>
                </Border>
            </Popup>
            <Image x:Name="AsteriskImage" 
                           Grid.Column="2" Source="/Assets/Asterisk.png" Stretch="None" Opacity="0"/>
        </Grid>
    </ControlTemplate>
</ResourceDictionary>
